package ioc17;

import java.beans.PropertyEditorSupport;

public class AddressEditorSurport extends PropertyEditorSupport {
    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        try {
        Address address = new Address();
        String[] s = text.split("-");
        address.setProv(s[0]);
        address.setCity(s[1]);
        setValue(address);

        } catch (IllegalArgumentException e) {
            e.printStackTrace();
            throw new IllegalArgumentException("参数转换异常");
        }
    }
}
